﻿namespace nyxwin.Data.Mail
{
	public class MailQuery
	{
		private static readonly MailQuery _default = new MailQuery();

		public MailQuery()
		{
			FirstId = null;
			LastId = null;
			FilterUser = string.Empty;
			FilterContents = string.Empty;
		}

		public int? FirstId { get; set; }
		public int? LastId { get; set; }
		public string FilterUser { get; set; }
		public string FilterContents { get; set; }

		public bool IsFilterUser
		{
			get { return !string.IsNullOrEmpty(FilterUser); }
		}

		public bool IsFilterContents
		{
			get { return !string.IsNullOrEmpty(FilterContents); }
		}

		public static MailQuery Default
		{
			get { return _default; }
		}

        public override bool Equals(object obj)
        {
            if (!(obj is MailQuery))
            {
                return false;
            }

            var other = obj as MailQuery;

            return other.FirstId == FirstId &&
                   other.LastId == LastId &&
                   other.FilterUser == FilterUser &&
                   other.FilterContents == FilterContents;
        }
	}
}